import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';

class LeaderPhone extends StatelessWidget {
  var leaderImg;
  var leaderPhone;

  LeaderPhone(this.leaderImg, this.leaderPhone);

  @override
  Widget build(BuildContext context) {
    return Container(
      child: InkWell(
        onTap: () {
          _luancherURL();
        },
        child: Image.network(leaderImg),
      ),
    );
  }

  void _luancherURL() async {
    String url = 'tel:' + leaderPhone;
    if (await canLaunch(url)) {
      await launch(url);
    } else {
      throw 'url无法访问';
    }
  }
}
